"""
格式化方式1
"""
name = "张三"
print("名字叫%s" % name)

age = 18
print("名字叫%s,年龄%s" % (name,age))

money = 155.20
print("名字叫%s,年龄%s,财产%s" % (name,age,money))

"""
精度控制
"""
age = 18  # %5d 表示将整数的宽度控制在5位,用三个空格补足宽度
money = 1.00  # %.2f 将小数点精度设置为2位
message = "观止%5d,身价：%.2f" % (age, money)
print(message)  # 输出 观止   18,身价：1.00

"""
格式化方式2
"""
name = "张三"
age = 18
money = 155.2
print(f"名字叫{name},年龄{age},财产{money}")